%Note that rP is a vector of return (rP = rPortfolio * weights).
%rPortfolio is a matrix of return of stocks.
function beta = getBeta_upon_Option(pP, pIndex, rP, rIndex, option)
    switch option
        case 'OLS'
            beta = BetaOLS(rP, rIndex);
        case 'Med Robust'
            beta = BetaRobustMed(rP, rIndex);
        case 'Trim Robust'
            beta = BetaRobustTrim(rP, rIndex);
        case 'Weight Robust'
            beta = BetaRobustWeight(rP, rIndex, 'andrews');
        case 'Shrinkage'
            beta = BetaShrinkage(rP, rIndex);
        case 'Bayes'
           beta = BetaBayes(rP, rIndex, 'HNX', 'HNXINDEX');
           %beta = BetaBayes(rP, rIndex, 'HOSE', 'VNINDEX');
        case 'Smoothing'
            %monthly lambda is 0.94
            %lambda = 0.94;
            
            %daily lambda is 0.97
            lambda = 0.97;
            beta = BetaSmoothing(rP, rIndex, lambda);
        case 'Kalman Filter'
            beta = BetaKalman(rP, rIndex, 1);
        case 'Tobit'
            beta = BetaTobit(rP, rIndex, 0.05);
        case 'Truncated'
            beta = BetaTruncated(rP, rIndex, 0.05);
        case 'GMM'
            beta = BetaGMM(pP, pIndex, 0.05, -0.05);
    end
